Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: pass task-specific config to backend #922

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

anhappdev
Copy link
Collaborator

Copy link

github-actions bot commented Sep 24, 2024

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

Comment on lines +250 to +257
custom_config {
id: "stable_diffusion_seed"
value: "633994880"
}
custom_config {
id: "stable_diffusion_num_steps"
value: "20"
}
Copy link
Collaborator Author

@anhappdev anhappdev Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This how a custom setting for all backends can be defined in tasks.pbtxt

Comment on lines +67 to +75
for (int i = 0; i < configs->count; ++i) {
if (strcmp(configs->keys[i], "stable_diffusion_seed") == 0) {
backend_data->seed = atoi(configs->values[i]);
}
if (strcmp(configs->keys[i], "stable_diffusion_num_steps") == 0) {
backend_data->num_steps = atoi(configs->values[i]);
}
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The backend can read them from mlperf_backend_configuration_t in mlperf_backend_create.

--lib_path="bazel-bin/mobile_back_tflite/cpp/backend_tflite/libtflitebackend.so" \
--custom_config="stable_diffusion_num_steps:20,stable_diffusion_seed:633994880" \
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the main.cc file for development, one can pass it with the flag custom_config

Copy link

sonarcloud bot commented Sep 24, 2024

@anhappdev anhappdev marked this pull request as ready for review September 24, 2024 15:12
@anhappdev anhappdev requested a review from a team as a code owner September 24, 2024 15:12
@anhappdev anhappdev changed the title feat: backend can read common custom setting from task definition feat: pass task-specific config to backend Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make the number of steps of stable diffusion configuration
1 participant